﻿using UnityEngine;
using System.Collections;

namespace Lost{
	/// <summary>
	/// 工具物品，即可以收进背包的物品
	/// </summary>
	public class ToolItem : InteractiveItem {
		public const string PrefabFolder = "Prefab/";
		/// 预设体名（路径）
		public string PrefabPath;
		public float ShowScale = 0.1f;

		public GameObject Prefab{
			get{ 
				Object o = Resources.Load (PrefabFolder + PrefabPath);
				if (o == null) {
					Debug.Log (PrefabPath + " isn't a prefab!");
				}
				return (o as GameObject);
			}
		}

		public override void Interact (HitInf hitInf)
		{
			base.Interact (hitInf);
			BackpackInteraction.PickUp (this);
		}

		public ToolItem CopyTo(GameObject target){
			ToolItem copyIT = target.AddComponent<ToolItem> ();
			copyIT.ItemName = this.ItemName;
			copyIT.Introduction = this.Introduction;
			copyIT.PrefabPath = this.PrefabPath;
			return copyIT;
		}
	}
}
